Skip to content

Remove TypeScript moving parts#512

Open
johnsoncodehk wants to merge 13 commits intomdx-js:mainfrom
johnsoncodehk:tsdk-free
Open

Remove TypeScript moving parts#512
johnsoncodehk wants to merge 13 commits intomdx-js:mainfrom
johnsoncodehk:tsdk-free

Conversation

@johnsoncodehk
Copy link
Copy Markdown
Contributor

@johnsoncodehk johnsoncodehk commented Jun 20, 2025

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

When MDX TypeScript support is already provided through the TS plugin, the language server's TypeScript moving parts seem unnecessary, and I think it can be removed along with the tsdk option to simplify IDE integration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 20, 2025

⚠️ No Changeset found

Latest commit: cf57c22

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jun 20, 2025
@johnsoncodehk johnsoncodehk marked this pull request as draft June 23, 2025 09:03
@remcohaszing
Copy link
Copy Markdown
Member

Description of changes

When MDX TypeScript support is already provided through the TS plugin, the language server's TypeScript moving parts seem unnecessary, and I think it can be removed along with the tsdk option to simplify IDE integration.

I agree it’s better to configure TypeScript support with the TypeScript plugin, not the language server. It’s still supported by the language server, because this may be needed for some editors. I don’t know if this is the case.

It’s nice that we have this. :)

  • When language server doesn't need TS support, the file watcher doesn't seem to be needed anymore.

Isn’t this needed for the markdown language service?

remark plugins register syntax extensions. For example, markdown directives may yield syntax errors unless the remark-directive plugin is added. virtualCodePlugins is needed for TypeScript indeed. But it’s also very useful to be able to inspect the generated virtual code. I think this can only be inspected via the language server, not via the TypeScript plugin.

@kentcdodds kentcdodds mentioned this pull request Sep 23, 2025
4 tasks
- Remove TypeScript-dependent tests from language server tests
- Tests for TypeScript features (hover, definitions, completions, etc.)
  should be tested through the TypeScript plugin instead
- Update expected capabilities in initialize test
- Update test command to only run test/*.test.js
- Keep basic language server functionality tests
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 31, 2026

Codecov Report

❌ Patch coverage is 80.65844% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.24%. Comparing base (4851c2d) to head (cf57c22).

Files with missing lines Patch % Lines
packages/language-server/lib/index.js 80.65% 47 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   92.43%   90.24%   -2.19%     
==========================================
  Files          13       13              
  Lines        1982     2123     +141     
==========================================
+ Hits         1832     1916      +84     
- Misses        150      207      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Add new test directory test/ts/ for TypeScript plugin tests
- Tests use @typescript/server-harness to test TypeScript features
- Migrate hover, definitions, completions, rename, diagnostics, code-action tests
- Update language server tests to remove TypeScript-dependent assertions
- Keep basic language server functionality tests
- Add test-ts script to run TypeScript plugin tests separately
- Language server now communicates with TypeScript plugin via tsserver
- TypeScript plugin registers _mdx:projectInfo command for getting tsconfig path
- VSCode extension forwards tsserver requests between language server and TS
- Language server reads MDX config (remarkPlugins, etc.) from tsconfig.json
- Falls back to finding tsconfig manually when tsserver bridge is unavailable
- Add @volar/language-core and @volar/language-service dependencies
Based on Vue Language Tools' implementation, this patch modifies the
TypeScript extension's internal code to:
1. Include 'mdx' in the list of supported language modes (jsTsLanguageModes,
   isSupportedLanguageMode, isTypeScriptDocument)
2. Ensure the MDX TypeScript plugin is loaded with high priority

This enables full TypeScript support for MDX files through the TS plugin,
including hover, definitions, completions, rename, and diagnostics.

If the TypeScript extension is already active when MDX extension loads,
the user will be prompted to restart the extension host.

Reference: https://github.com/vuejs/language-tools/blob/master/extensions/vscode/src/extension.ts#L286-L365
Re-enable the file watcher to watch MDX files, which is needed for the
markdown language service to properly track file changes.
Remove the TypeScript extension patching code as it should be done in a
separate PR. This keeps the current PR focused on the tsdk-free changes.
@johnsoncodehk johnsoncodehk marked this pull request as ready for review January 31, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤞 phase/open Post is being triaged manually

Development

Successfully merging this pull request may close these issues.

2 participants